/**
 * @param {number} n
 * @return {number}
 */
 var numberOfMatches = function(n) {
  let count = 0
  while(n > 1) {
    // 如果是偶数
   if(n % 2 === 0){
    count = count + n / 2
     n = n / 2
   } else {
     count = count + (n-1) / 2
     n = (n-1) / 2 + 1
   }
  }
  return count
};

for(let i = 1; i < 200; i++) {
  console.log(`参数队伍共${i}支:`,numberOfMatches(i))
}